package com.example.tang.zhayan.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.tang.zhayan.R;
import com.example.tang.zhayan.bean.SearchDesignerItem;
import com.squareup.picasso.Picasso;

import java.util.List;

/**
 * Created by tang on 2015/12/17.
 */
public class SearcheDesignerAdapter extends BaseAbstractAdapter<SearchDesignerItem> {


    public SearcheDesignerAdapter(Context context, List<SearchDesignerItem> list) {
        super(context, list);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (holder == null) {
            convertView = inflater.inflate(R.layout.ptrlistview_search_item, null);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.tvName.setText(list.get(position).getStylist_name());
        Picasso.with(context).load(list.get(position).getStylist_img()).into(holder.imgHead);
        return convertView;
    }

    class ViewHolder {
        ImageView imgHead;
        TextView tvName;

        public ViewHolder(View convertView) {
            imgHead = (ImageView) convertView.findViewById(R.id.iv_search_img);
            tvName = (TextView) convertView.findViewById(R.id.tv_search_name);
        }
    }

}
